package designPattern.Singleton;

/**
 * @author ldy
 * @data 2022/11/8
 * @description 饿汉模式，单例实例在类装载的时候 (使用静态代码块） 进行创建，是线程安全的
 */
public class SingletonExample6 {
    private SingletonExample6(){}

    private static SingletonExample6 instance = null;

    static {
        instance = new SingletonExample6();
    }

    public static SingletonExample6 getInstance(){
        return instance;
    }
}
